<?php

		$page = (int) $_POST['page'];
		
		if(!$page || $page == 0){
			echo json_encode(array('error'=>'Có lỗi xảy ra, vui lòng thử lại.'));
			exit();
		}
		
		$alias = $_POST['alias'];
		$array=explode("_",$alias);
		$vl=$array[1];
		switch ($vl){
			case 'pick':
				$cache=new cache;
				$_GET['page'] = (int) $_POST['page'];
				
				

				
				$sql ="select * from blog_video where pick=1 and status=1 order by id desc";
				$sql2="select * from blog_video where pick=1 and status=1 ";
			
				$pager = new Pagination($sql,5, 4, '', 300);
				$pager->setDebug(false);
				$data['pick'] = $pager->paginate($cache,$sql2);
				
			
				if(!$data['pick']){
					echo json_encode(array('error'=>'Hết dữ liệu!'));
					exit();
				}

				echo json_encode(array('content'=>video_render_item_row($data['pick'])));
				break;
				
				case 'moi':
				$cache=new cache;
				$_GET['page'] = (int) $_POST['page'];
				
				

				
				$sql ="select * from blog_video where status=1 order by id desc";
				$sql2="select * from blog_video where status=1 ";
			
				$pager = new Pagination($sql,5, 4, '', 300);
				$pager->setDebug(false);
				$data['pick'] = $pager->paginate($cache,$sql2);
				
			
				if(!$data['pick']){
					echo json_encode(array('error'=>'Hết dữ liệu!'));
					exit();
				}

				echo json_encode(array('content'=>video_render_item_row($data['pick'])));
				break;
				
				case 'category':
				$cache=new cache;
				$_GET['page'] = (int) $_POST['page'];
				
				

				$cat=$array[2];
				$sql ="select * from blog_video where category=$cat and status=1 order by id desc";
				$sql2="select * from blog_video where category=$cat and status=1 ";
			
				$pager = new Pagination($sql,5, 4, '', 300);
				$pager->setDebug(false);
				$data['pick'] = $pager->paginate($cache,$sql2);
				
			
				if(!$data['pick']){
					echo json_encode(array('error'=>'Hết dữ liệu!'));
					exit();
				}

				echo json_encode(array('content'=>video_render_item_row($data['pick'])));
				break;
				
		
			
				
		}
		exit();

  ?>